<!--
 * @Description:
 * @Version: 1.0
 * @Author: liguansheng
 * @Date: 2022-08-24 14:14:29
 * @LastEditors: liguansheng
 * @LastEditTime: 2022-08-26 11:12:30
-->
<template>
  <el-form
    :model="form"
    :rules="rules"
    label-width="120px"
    label-position="top"
  >
    <el-form-item
      label="回调Url"
      prop="callbackUrl"
    >
      <el-input
        v-model="form.callbackUrl"
      />
    </el-form-item>
    <el-form-item
      label="Logout Url"
      prop="logoutUrl"
    >
      <el-input
        v-model="form.logoutUrl"
      />
    </el-form-item>
  </el-form>
</template>

<script setup lang="ts">
import { IElFormRule } from '@/types/element-plus'
import { PropType, ref, watch } from 'vue'
const props = defineProps({
  modelValue: {
    type: Object as PropType<{
      callbackUrl: string
      logoutUrl: string
    }>,
    required: true
  }
})
interface EmitsType {
  (e: 'update:modelValue', form: {
      callbackUrl: string
      logoutUrl: string
    }): void
}
const emit = defineEmits<EmitsType>()

const form = ref(props.modelValue)
const rules = ref<IElFormRule>({

})
watch(() => props.modelValue, () => {
  form.value = props.modelValue
}, {
  deep: true
})

watch(form.value, () => {
  emit('update:modelValue', form.value)
})
</script>

<style scoped lang="scss">

</style>
